package com.hqyj.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@TableName("personnel_transfer")
public class PersonnelTransfer extends MyPage implements Serializable {
 //主键
 @TableId(value = "id",type = IdType.AUTO)
 //编号
  private Integer id;

 //TableField 非主键的注解 ，定义的属性和列名的映射关系
 @TableField(value = "employee_id")
 //员工编号
   private Integer  employeeId;

 @TableField(value = "name")
 //员工姓名
 private String name;

 @TableField(value = "original_department")
 // 原部门
    private String  originalDepartment;

 @TableField(value = "original_position")
 //原职务
 private String originalPosition;

 @TableField(value = "new_department")
 //新部门
    private String newDepartment;

 @TableField(value = "new_position")
 //新职务
    private String  newPosition;

 @TableField(value = "transfer_time")
 //调动时间
    private Date transferTime;

 @TableField(value = "reasons_transfer")
 //调动原因
     private String reasonsTransfer;


 @TableField(exist = false)
   //排序
   private String sort;


    public String getTransferTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if(this.transferTime!=null){
            return sdf.format(this.transferTime);
        }
        return "";
    }

    public void setTransferTime(String transferTime) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        try {
            this.transferTime = sdf.parse(transferTime);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }


}
